-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Mount SD card as RW on kobo, but ignore errors #1845
Conversation
@@ -80,6 +80,9 @@ if [ ! -n "${PLATFORM}" ] ; then | |||
fi | |||
# end of value check of PLATFORM | |||
|
|||
# Remount SD to RW, ignore errors since we may not have sd card |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Instead of ignoring errors no matter what wouldn't it be better to perform a test like if [ -f /mnt/sd ]; then
or mount | grep /tmp/sd
(exit status is 0 or is not 1) or something?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If [ -f won't work, the /mnt/sd folder always exists, even sd card is not mounted. And one more concern is, even /dev/mmcblk1p1 (sd card block device) is existing, we may still not able to mount it as RW. i.e. the file system may not be supported. But if the file system is supported, remount as RW should always succeed. So simply ignoring the error may be the most simply way to solve most cases.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What about my second suggestion regarding checking whether it is in fact already mounted using either mount itself or e.g. cat /proc/mounts?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I surely can implement a more complex logic, i.e.
mount | grep -P ' /mnt/sd .*rw'
if [ $? ]
then
mount -o remount,rw /mnt/sd
fi
But it seems the change won't make things better. We may still fail to mount the partition as RW, which has exactly same possibility as current solution.
What do you think?
I'm inclined to think that a failed to remount error is at least
|
Frenzie, there must be something I have not described clearly. KenMaltby, are you sure it may fail on your device? Actually this command is exactly the same as what's in KSM. P.S. I am also using a Kobo AuraHD. |
Tshering's scripts to remount and check the status of the external SD include feedback to the user; including: answer=$(mount -v -o remount,rw /mnt/sd 2>&1)
I don't know why I had to insure the trailing "/" was there, to get it to work in recent implementations, but that is my experience. |
Look at the platform/kindle/koreader.sh script if you want an example of cheap "is something already mounted?" check, where we use a bunch of them when bind-mounting custom font paths. |
I think it would make for better debugging by not spamming error messages about an SD card that isn't there in the first place.
As a user I'd rather have it working imperfectly than being faced with a draconian denial of service. |
OK, based on the discussion above, I think it can be summarized as below.
Let me know if I missed anything ;) @Hzj-jie is right in that simply doing That said, I too prefer we put in some extra checking logic here for couple reasons:
Lastly, thank you @Hzj-jie for working on this legacy setting cleanup effort :) |
While I have been using a remount of the external uSD card, without checks for a long time now and have had no problems related to that, it will be nice not to have to add it with each version update. I think the checks are needed, as you can never tell what the average user may encounter thru mischance or accident. |
KenMaltby, no, no matter existing solution (with check) or older solution (without check), end users won't be impacted if sd card is not mountable or not existing. I have updated this change with a check. Please kindly let me know if we still prefer '|| true' for remount command. |
If you need battle-tested 'is something mounted ro?' and 'remount that rw!' checks, we have some in MRPI. It might be a tad overkill, but I'm not as familiar with how the various Kobo might mess this up to judge ;). I can just say that something as simple as that bit us in the ass a couple of times until it was reimplemented like this on the Kindle side ;). |
For the Kobos there is also the use of "Launchers", like KSM, that might be used to change the status of the external drive and of course there is Nickel and its impact on things. Also "syncthing", now. http://www.mobileread.com/forums/showpost.php?p=3266630&postcount=122 |
Yes, I have a kobo aura hd myself. The machine always starts with sd card mounted as ro, so I prepared this change to make koreader sdr config work for sd card. |
Mount SD card as RW on kobo, but ignore errors
Thanks @NiLuJe for the pointer to MRPI, it does looks more robust. We should definitely do the same for kroeader too :) |
This change is to mount sd card as RW on kobo devices. Currently we are using sdr doc config, which needs write permission to the location where the original books store. But by default, sd card on kobo is mounted as RO, so the sdr doc config won't be written.